package com.bigShen.pattern.decorator.login.wrapper;

import com.bigShen.pattern.decorator.login.ResultMsg;
import com.bigShen.pattern.decorator.login.old.ILoginService;

/**
 * @author : lei.shen
 * @date : 2018/10/7
 */
public class LoginForThirdService implements ILoginForThirdService{

    private ILoginService loginService;

    public LoginForThirdService(ILoginService loginService) {
        this.loginService = loginService;
    }

    public ResultMsg loginForQQ(String openId) {
        System.out.println("QQ 登录");
        this.regisier(openId, null);
        return this.login(openId, null);
    }

    public ResultMsg loginForWeChat(String openId) {
        this.regisier(openId, null);
        return this.login(openId, null);
    }

    public ResultMsg loginForToken(String token) {
        return null;
    }

    public ResultMsg loginForSina(String openId) {
        this.regisier(openId, null);
        return this.login(openId, null);
    }

    public ResultMsg regisier(String userName, String password) {
        return this.loginService.regisier(userName, password);
    }

    public ResultMsg login(String userName, String password) {
        return this.loginService.login(userName, password);
    }

}
